package com.fantasy.easy.biz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fantasy.easy.biz.domain.BizEmployee;
import com.fantasy.easy.biz.service.BizEmployeeService;
import com.fantasy.easy.biz.mapper.BizEmployeeMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 *
 */
@Service
public class BizEmployeeServiceImpl extends ServiceImpl<BizEmployeeMapper, BizEmployee>
    implements BizEmployeeService{

    @Resource
    BizEmployeeMapper bizEmployeeMapper;

    @Override
    public IPage<BizEmployee> queryAll(BizEmployee bizEmployee, Page<BizEmployee> p) {
        return bizEmployeeMapper.selectPage(p,new QueryWrapper<>());
    }

    @Override
    public int insert(BizEmployee bizEmployee) {
        if (bizEmployee.getId() == 0){
            bizEmployee.setId(null);
            return bizEmployeeMapper.insert(bizEmployee);
        }
        return bizEmployeeMapper.updateById(bizEmployee);
    }
}




